/**
 * FileName :ResultData.java
 *
 * @Author :LiangPeng
 * @version :1.0
 * Date     :2016年1月6日
 * Company  :石化盈科信息技术有限责任公司
 * Description:物流汇管控台
 */
package cn.huiyunche.base.service.vo;

import java.io.Serializable;

/**
 * Title: 返回结果 Description:返回结果信息格式化
 *
 * @Author :LiangPeng
 * @Date :2016年1月6日
 * @Version:1.0
 */
public class Result<T> implements Serializable {

    /**
     * @fieldName: serialVersionUID
     * @fieldType: long
     * @Description: TODO
     */
    private static final long serialVersionUID = -6820865870078657785L;

    // 返回状态
    private boolean success;

    // 返回数据
    private T data;

    // 返回结果代码
    private String messageCode;
    // 返回结果信息
    private String message;

    public Result() {
    }

    public Result(boolean success, T data, String message) {
        this.success = success;
        this.data = data;
        this.message = message;
    }

    public Result(boolean success, T data, String messageCode, String message) {
        this.success = success;
        this.data = data;
        this.message = message;
        this.messageCode = messageCode;
    }

    public Result(boolean success, String message) {
        this.success = success;
        this.message = message;
    }

    public Result(boolean success) {
        this.success = success;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getMessageCode() {
        return messageCode;
    }

    public void setMessageCode(String messageCode) {
        this.messageCode = messageCode;
    }

    @Override
    public String toString() {
        String data = getData() == null ? "" : getData().toString();
        return "Result ["
                + "success = " + isSuccess() + ","
                + "messageCode = " + getMessageCode() + ","
                + "message = " + getMessage() + ","
                + "data = {" + data
                + "}]";
    }
}
